<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="${ctx!}/assets/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx!}/assets/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${ctx!}/assets/css/animate.css" rel="stylesheet">
    <link href="${ctx!}/assets/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="${ctx!}/assets/css/admin-main.css" rel="stylesheet">

</head>

<body>
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-content">
                <form class="form-horizontal m-t" id="frm" method="post" action="${ctx!}/admin/project/edit">
                    <input type="hidden" id="id" name="id" value="${project.id}">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目ID：</label>
                        <div class="col-sm-8">
                            <input id="identification" name="identification" class="form-control" type="text"
                                   value="${project.identification}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目名称：</label>
                        <div class="col-sm-8">
                            <input id="name" name="name" class="form-control" type="text" value="${project.name}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">所在地区：</label>
                        <div class="col-sm-8">
                            <input id="city" name="city" class="form-control" type="text" value="${project.city}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">起始时间：</label>
                        <div class="col-sm-8">
                            <input id="createTime" name="createTime" class="laydate-icon form-control layer-date"
                                   value="${project.createTime}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目介绍：</label>
                        <div class="col-sm-8">
                            <textarea style="vertical-align: top; resize: none" rows="5" id="description"
                                      name="description" class="form-control"
                                      type="text">${project.description}</textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目占地面的(平方万米)：</label>
                        <div class="col-sm-8">
                            <input id="name" name="area" class="form-control" type="text" value="${project.area}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目最大冷负荷：</label>
                        <div class="col-sm-8">
                            <input id="name" name="maxColdLoad" class="form-control" type="text"
                                   value="${project.maxColdLoad}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">项目最大热负荷：</label>
                        <div class="col-sm-8">
                            <input id="name" name="maxHotLoad" class="form-control" type="text"
                                   value="${project.maxHotLoad}">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-10 col-sm-offset-3 btn-box">
                            <button class="btn btn-primary" type="submit">确认</button>
                            <button class="btn btn-primary" onclick="back()" type="reset">取消</button>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>
</div>


<!-- 全局js -->
<script src="${ctx!}/assets/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctx!}/assets/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="${ctx!}/assets/js/content.js?v=1.0.0"></script>

<!-- jQuery Validation plugin javascript-->
<script src="${ctx!}/assets/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${ctx!}/assets/js/plugins/validate/messages_zh.min.js"></script>
<script src="${ctx!}/assets/js/plugins/layer/layer.min.js"></script>
<script src="${ctx!}/assets/js/plugins/layer/laydate/laydate.js"></script>
<script type="text/javascript">


    $(document).ready(function () {

        //外部js调用
        laydate.render({
            theme: "#23b7e5",
            elem: '#createTime', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
            trigger: 'click',
            type: 'date',
        });

        $("#frm").validate({
            rules: {
                name: {
                    required: true,
                },
                city: {
                    required: true,
                },
                description: {
                    required: false,
                },
                createTime: {
                    required: true,
                },
                identification: {
                    required: true,
                },
            },
            messages: {},
            submitHandler: function (form) {
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "${ctx!}/admin/project/edit",
                    data: $(form).serialize(),
                    success: function (data) {
                        layer.msg(data.message, {time: 2000}, function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index);
                        });
                    }


                });
            }
        });
    });
</script>

</body>

</html>
